package org.springblade.modules.opcua.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.modules.opcua.entity.OpcTarget;
import org.springblade.modules.opcua.mapper.OpcTargetMapper;
import org.springblade.modules.opcua.model.OpcTargetBean;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Version 1.0
 */
@Service
public class OpcTargetService extends BaseServiceImpl<OpcTargetMapper, OpcTarget> {


    public OpcTargetBean findBySpec(OpcTargetBean param) {
        List<OpcTargetBean> list = this.baseMapper.queryList(param);
        if (list == null || list.size() == 0) {
            return null;
        }
        return list.get(0);
    }

    public List<OpcTargetBean> findListBySpec(OpcTargetBean param) {
        return this.baseMapper.queryList(param);
    }


    public IPage<OpcTargetBean> findPageBySpec(IPage<OpcTargetBean> page, OpcTargetBean param) {
        List<OpcTargetBean> dataList = baseMapper.queryPageList(page, param);
        return page.setRecords(dataList);
    }
}

